# Makefile for the project
# 起因：在benchspec/CPU/507.cactuBSSN_r/run/run_base_refrate_X86_GCC-m64.0000/spec_ref.out中，运行结果只有一个84
# 目标：打印三个84，让benchspec/CPU/507.cactuBSSN_r/run/run_base_refrate_X86_GCC-m64.0000/spec_ref.out.cmp显示pass
# make t4 &> ./makeout/BUILD2.txt

# Veriable


GCC_HOME=/media/tk/Data/Source/GNU/gcc-code/gcc-15.1.0/BUILD5/install


#GCC_PATH=/usr/bin/
GCC_PATH=$(GCC_HOME)/bin


GCC_EXE=$(GCC_PATH)/gcc #x86_64-linux-gnu-gcc#

#export PATH="$(GCC_PATH):$(PATH)"
#export LD_LIBRARY_PATH="$(GCC_PATH)/x86_64-pc-linux-gnu/libgcc:$(LD_LIBRARY_PATH)"

#benchspec/CPU/507.cactuBSSN_r/build/build_base_X86_GCC-m64.0000/make.out
t1:#打印最后一个84
	$(GCC_EXE) -v
	$(GCC_EXE)     -std=c99   -m64 -o PUGH/PughUtils.o -DSPEC 	       -DNDEBUG -DSPEC_AUTO_SUPPRESS_OPENMP -Iinclude -DCCODE -g -O3 -march=native -fno-unsafe-math-optimizations -fno-tree-loop-vectorize -DSPEC_LP64  PUGH/PughUtils.c
	./PUGH/PughUtils.o
t2:# 打印三个84
	$(GCC_EXE)  -v
	$(GCC_EXE)     -std=c99   -m64 -o PUGH/PughUtils.o -DSPEC -DSPEC_CPU -DNDEBUG  							-Iinclude -DCCODE -g        -fopenmp -DSPEC_OPENMP    											-DSPEC_LP64  PUGH/PughUtils.c
	./PUGH/PughUtils.o

#benchspec/CPU/507.cactuBSSN_r/src/simple-build-cactusBSSN_r-507.sh
#benchspec/CPU/507.cactuBSSN_r/build/build_base_X86_GCC-m64.0000/simple-build-cactusBSSN_r-507.sh 
t3:	# 打印三个84
	$(GCC_EXE)  -v
	$(GCC_EXE)     -std=c99   -m64 -o PUGH/PughUtils.o -DSPEC -DSPEC_CPU -DNDEBUG -DSPEC_AUTO_SUPPRESS_OPENMP -Iinclude -DCCODE -g                        													-DSPEC_LP64  PUGH/PughUtils.c
	./PUGH/PughUtils.o
t4:# 打印一个84
	$(GCC_EXE)  -v
	$(GCC_EXE)     				  -o PUGH/PughUtils.o 			-O3																																			 PUGH/PughUtils.c
	./PUGH/PughUtils.o
t5:# 打印三个84
	$(GCC_EXE)  -v
	$(GCC_EXE)     				  -o PUGH/PughUtils.o 																																						 PUGH/PughUtils.c
	./PUGH/PughUtils.o
t6:# 正常risc-v的编译选项, x86上还是打印最后一个84
	$(GCC_EXE)  -v
	$(GCC_EXE)  -std=c99 			  -o PUGH/PughUtils.o -DSPEC 			-DNDEBUF -DSPEC_AUTO_SUPPRESS_OPENMP -Iinclude -DCCODE -g 	-O3 -static  -fno-strict-aliasing										 PUGH/PughUtils.c
	./PUGH/PughUtils.o
gdb:
	gdb ./PUGH/PughUtils.o
gcc: #快速切换GCC版本 see:https://docs.qq.com/doc/DZVFTY2FQTkxzZkFL
	sudo update-alternatives --config gcc